package com.oocl.o2o.merchant.entity;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import org.hibernate.annotations.GenericGenerator;

import com.fasterxml.jackson.annotation.JsonFormat;

// beacuse of comment is keyword. so change to commentary
@Entity
@GenericGenerator(name = "commentary_id_generator", strategy = "uuid")
public class Commentary {
	@Id
	@GeneratedValue(generator = "commentary_id_generator")
	@Column(columnDefinition = "char(32)")
	// uuid
	private String id;
	@Column(name = "customer_commentary")
	// the content of customer commentary
	private String customerCommentary;
	@Column(name = "merchant_commentary")
	// the content of merchant commentary
	private String merchantCommentary;
	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "customer_commentary_date")
	@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss", timezone="GMT+8")
	private Date customerCommentaryDate;
	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "merchant_commentary_date")
	@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss", timezone="GMT+8")
	private Date merchantCommentaryDate;

	@ManyToOne
	@JoinColumn(name = "merchant_id", columnDefinition = "char(32)")
	private Merchant merchant;
	@ManyToOne
	@JoinColumn(name = "customer_id", columnDefinition = "char(32)")
	private Customer customer;
	private int grade;//星级

	public Commentary() {
	}

	

	public Commentary(String id, String customerCommentary,
			String merchantCommentary, Date customerCommentaryDate,
			Date merchantCommentaryDate, Merchant merchant, Customer customer,
			int grade) {
		super();
		this.id = id;
		this.customerCommentary = customerCommentary;
		this.merchantCommentary = merchantCommentary;
		this.customerCommentaryDate = customerCommentaryDate;
		this.merchantCommentaryDate = merchantCommentaryDate;
		this.merchant = merchant;
		this.customer = customer;
		this.grade = grade;
	}

	public String getCustomerCommentary() {
		return customerCommentary;
	}

	public void setCustomerCommentary(String customerCommentary) {
		this.customerCommentary = customerCommentary;
	}

	public String getMerchantCommentary() {
		return merchantCommentary;
	}

	public void setMerchantCommentary(String merchantCommentary) {
		this.merchantCommentary = merchantCommentary;
	}

	public Date getCustomerCommentaryDate() {
		return customerCommentaryDate;
	}

	public void setCustomerCommentaryDate(Date customerCommentaryDate) {
		this.customerCommentaryDate = customerCommentaryDate;
	}

	public Date getMerchantCommentaryDate() {
		return merchantCommentaryDate;
	}

	public void setMerchantCommentaryDate(Date merchantCommentaryDate) {
		this.merchantCommentaryDate = merchantCommentaryDate;
	}

	public Merchant getMerchant() {
		return merchant;
	}

	public void setMerchant(Merchant merchant) {
		this.merchant = merchant;
	}

	public Customer getCustomer() {
		return customer;
	}

	public void setCustomer(Customer customer) {
		this.customer = customer;
	}



	public int getGrade() {
		return grade;
	}



	public void setGrade(int grade) {
		this.grade = grade;
	}



	public String getId() {
		return id;
	}

}
